<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><{:C('web_site_name')}>--系统环境变量设置</title>
<link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/common.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo APP_TMPL_PATH ; ?>/static/css/main.css"/>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/fileuploader.js"></script>


</head>
<body>



<div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i>首页<span class="crumb-step">&gt;</span><span class="crumb-name">系统基本变量设置</span></div>
        </div>
        
        <div class="result-wrap">
          
                
                <div class="result-content">
                    <div class="config-items">
                    
                    <div class="itab">
                    <ul> 
                    	<?php 
                    		
                    		foreach($group as $k => $v ){
							
							$class = '' ;
							if($gid == $k ){$class="class='selected'";}
						
                    	?>
                        <li><a href="javascript:void(0)"  <?php echo $class;?> onclick="tab_(<?php echo $k;?> , this )"><?php echo $v;?></a></li> 
                       <?php } ?>
                       <li><a href="javascript:void(0)" <?php if($gid == 980000){echo "class='selected'";}?>  onclick="tab_('980000', this )">添加环境变量</a></li> 
  			  
  					</ul>
                    </div>
                    <div style="clear:both"></div>
                   <div class="result-content" >
						<?php
						
						foreach ($list as $list_key => $list_val){
						if($gid == $list_key ){$class='display:';}else{$class='display:none';}
						?>
						<form id="form_<?php echo $list_key ;?>" enctype="multipart/form-data" action="<?php echo U("sysconfig/edit", array('gid'=>$list_key) )?>" method="post">
                        <table  class="insert-tab" id="tab_<?php echo $list_key;?>_<?php echo $child_key;?>" style="<?php echo $class;?>">
                            <tbody>
							<?php foreach($list_val as $child_key => $child_val){?>
							<tr >
                                <th ><i class="require-red">*</i><?php echo $child_val['info'];?>：</th>
                                <td><?php echo $child_val['text'];?></td>
                            </tr>
							<?php }?>
                               
                               
                                <tr>
                                    <th></th>
                                    <td>
                                        <a  value="提交" onclick="document.getElementById('form_<?php echo $list_key ;?>').submit()" class="btn btn-primary btn6 mr10">提交</a>
                                    </td>
                                </tr>
                            </tbody></table>
							
							</form>
							<?php } ?>
	<form name="myform" style="height:500px" enctype="multipart/form-data" id="myform" method="post" action="<?php echo U("sysconfig/add")?>">						
<table   class="insert-tab" id="tab_980000" style="<?php if($gid == 980000){echo 'display:';}else{echo 'display:none';}?>">
                            <tbody>
                            
   						
                            <tr >
                                <th ><i class="require-red">*</i>变量组：</th>
                                <td>
                                	<select name="gid" class="select2">
       	<?php 
       
  			if(isset($group) && $group){
  				foreach($group as $gkey_ => $gval_){	
  			
  		?>
  		<option value="<?php echo $gkey_ ;?>"><?php echo $gval_ ;?></option>
  		<?php 
  			}
  		}	
  		?>
       					</select>
                                </td>
                            </tr>
 <tr >
                                <th ><i class="require-red">*</i>变量类型：</th>
                                <td>
                                	<select name="type">
       	<?php 
       
  			if(isset($type) && $type){
  				foreach($type as $typekey_ => $typeval_){	
  			
  		?>
  		<option value="<?php echo $typekey_;?>"><?php echo $typeval_ ;?></option>
  		<?php 
  			}
  		}	
  		?>
       	</select>
                                </td>
                            </tr>    
							<tr  >
                                <th ><i class="require-red">*</i>变量名称：</th>
                                <td>
                                	<input class="common-text" type="text" value="" name="varname">必须是英文
                                </td>
                            </tr>  
                            <tr class="other">
                                <th ><i class="require-red">*</i>变量值：</th>
                                <td>
                                	<input class="common-text" type="text" value="" name="value">如果变量类型是boolean值，此处必须填写 N或者Y
                                </td>
                            </tr> 
							<tr class="file" style="display:none">
                                <th ><i class="require-red">*</i>图片：</th>
                                <td>
                                	<input class="common-text" type="file" value="" name="varname">
                                </td>
                            </tr>  
                            
                            <tr >
                                <th ><i class="require-red">*</i>变量说明：</th>
                                <td>
                                	<input class="common-text" type="text" value="" name="info">
                                </td>
                            </tr> 
                             <tr >
                                <th ><i class="require-red">*</i>排序：</th>
                                <td>
                                	<input class="common-text" type="text" value="0" name="disorder">
                                </td>
                            </tr> 
                           
                            <tr >
                                <th ></th>
                                <td>
                                <input type="submit" value="添加系统变量" class="btn btn-primary btn6 mr10">
                                </td>
                            </tr>                  
                            </tbody>
                            
                            </table>	
</form>							
                    </div>
                </div>
                </div>
           
        </div>
       
        
    
   </body>
   </html>    
   
<script>
function tab_(id , o){
	if(id == 980000){
		$("#submit_1").hide();
	}else{
		$("#submit_1").show();
	}
	$(".insert-tab").hide();
	$("table[id^='tab_"+id+"']").show();
	$(".itab ul li a").removeClass("selected");
	$(o).addClass("selected");
}
$(function(){
	$("select[name='type']").change(function(){
		if($(this).val() == 'file'){
			$(".file").show();
			$(".other").hide();
		}else{
			$(".file").hide();
			$(".other").show();
		}
	});



});
var loadding_0;
function ajax_upload_pic(myid){

    var img_uploader = new qq.FileUploaderBasic({
        allowedExtensions: ['jpg','gif','jpeg','png'],
        button: document.getElementById(myid),
        multiple: false,
        action: "<{:U('sysconfig/index')}>&action=upload",
        inputName: 'file_'+myid,
        forceMultipart: true, //用$_FILES
        messages: {
            typeError: "图片类型出错",
            //sizeError: "七个上传小图",
            //minSizeError: lang.upload_minsize_error,
            //emptyError: lang.upload_empty_error,
            noFilesError: "没有文件上传"
            //onLeave: lang.upload_onLeave
        },
        showMessage: function(message){
           alert(message);
        },
        onSubmit: function(id, fileName){
        	loadding_0 = layer.load('图片正在上传中，请稍等。。。。'); 
        },
        onComplete: function(id, fileName, result){
			if(result['status']){
				$("#value_"+myid).val(result['info']['savename']);
				$("#"+myid).remove();
			}else{
				layer.msg(result['message']);
			}
            layer.close(loadding_0);
        }
    });	
}	
function del_var(url , varname){
	$.layer({
	    shade: [1],
	    area: ['240px','auto'],
	    dialog: {
	        msg: '确定删除系统环境变量是:'+varname+",此操作不可恢复！",
	        btns: 2,                    
	        type: 4,
	        btn: ['确定','取消'],
	        yes: function(){
	        	window.location.href=url ; 
	            //layer.msg('重要', 1, 1);
	        }, no: function(){
	            
	        }
	    }
	});
}
</script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/lib.js"></script>
<script type="text/javascript" src="<?php echo APP_TMPL_PATH ; ?>/static/js/layer/layer.min.js"></script>
        